

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>表单组合</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/layuikn/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/layuikn/style/admin.css" media="all">
</head>

<style>
    #option_jibing .layui-form-checkbox{
        margin-bottom: 10px;
    }
    .layui-form-radio{
        margin: 0;
    }
    .layui-form-label{
        /*width: 180px;*/
    }
    .layui-input:disabled{
        background: rgb(248,248,248);
    }
</style>

<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header"><h2>PG-SGA医务人员评估</h2></div>
        <div class="layui-card-body" style="padding: 15px;">
            <fieldset class="layui-elem-field" style="padding: 20px;">
                <legend style="font-size: 15px;">个人信息</legend>
                <div class="layui-row">
                    <div class="layui-col-md4">住院号：<span id="huanzhe_hospital_id"></span></div>
                    <div class="layui-col-md4">姓名：<span id="huanzhe_name"></span></div>
                    <div class="layui-col-md4">性别：<span id="huanzhe_gender"></span></div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-md4">科室：<span id="huanzhe_keshi"></span></div>
                    <div class="layui-col-md4">年龄：<span id="huanzhe_age"></span></div>
                    <div class="layui-col-md4">录入日期：<span id="huanzhe_created"></span></div>
                </div>
            </fieldset>
            <form class="layui-form" action="" lay-filter="pgsgayisheng-form">
                <fieldset class="layui-elem-field" style="padding: 20px;">
                    <legend style="font-size: 15px;">PG-SGA医务人员评估</legend>
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <div style="font-weight: 600;margin-bottom: 10px;">1、疾病</div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <input hidden value="" type="text" name="jibing" disabled>
                                    <div class="layui-col-md6" id="option_jibing">
                                        <div class="layui-col-md4">
                                            <input type="checkbox" name="" value="男" title="癌症" checked="">
                                        </div>
                                        <div class="layui-col-md4">
                                            <input type="checkbox" name="" value="男" title="AIDS" checked="">
                                        </div>
                                        <div class="layui-col-md4">
                                            <input type="checkbox" name="" value="男" title="呼吸或心脏病恶病质" checked="">
                                        </div>
                                        <div class="layui-col-md4">
                                            <input type="checkbox" name="" value="男" title="癌症" checked="">
                                        </div>
                                        <div class="layui-col-md4">
                                            <input type="checkbox" name="" value="男" title="AIDS" checked="">
                                        </div>
                                        <div class="layui-col-md4">
                                            <input type="checkbox" name="" value="男" title="呼吸或心脏病恶病质" checked="">
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <div class="layui-inline">总分</div>
                                            <div class="layui-inline">
                                                <input type="text" value="0" name="zongfen" id="zongfen" readonly autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <div class="layui-col-md6">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <div class="layui-inline">相关疾病(断定)</div>
                                                <div class="layui-inline">
                                                    <input type="text" name="panding" id="panding" readonly autocomplete="off" class="layui-input" style="width: 600px;">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <div class="layui-inline">年龄</div>
                                                <div class="layui-inline">
                                                    <input type="text" name="age" readonly autocomplete="off" class="layui-input" style="width: 200px;">
                                                </div>
                                                <div class="layui-inline">岁</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <div class="layui-col-md6">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <div class="layui-inline">原发疾病的分期</div>
                                                <div class="layui-inline">
                                                    <input type="radio" name="fenqi" value="1" title="I">
                                                    <input type="radio" name="fenqi" value="2" title="II">
                                                    <input type="radio" name="fenqi" value="3" title="III">
                                                    <input type="radio" name="fenqi" value="4" title="IV">
                                                    <input type="radio" name="fenqi" value="0" title="其它">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <div style="font-weight: 600;margin-bottom: 10px;">2、应激状态</div>
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <div class="layui-inline">目前体温</div>
                                            <div class="layui-inline">
                                                <input type="text" name="tiwen" autocomplete="off" class="layui-input">
                                            </div>
                                            <div class="layui-inline">℃</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <div class="layui-inline">如果为发热，发热持续时间</div>
                                            <div class="layui-inline">
                                                <input type="text" name="fare_time" autocomplete="off" class="layui-input">
                                            </div>
                                            <div class="layui-inline">小时；</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <div class="layui-inline">是否用糖皮质激素</div>
                                            <div class="layui-inline">
                                                <input type="radio" name="tangpijishu" lay-filter="tangpijishu" value="1" title="是">
                                                <input type="radio" name="tangpijishu" lay-filter="tangpijishu" value="0" title="否">
                                            </div>
                                            <div class="layui-inline">药名</div>
                                            <div class="layui-inline">
                                                <input type="text" name="yaowu" disabled class="layui-input">
                                            </div>
                                            <div class="layui-inline">最大总剂量/天(mg)</div>
                                            <div class="layui-inline">
                                                <input type="text" name="jiliang" disabled class="layui-input">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <div class="layui-row">
                                        <div class="layui-col-md2">应激</div>
                                        <div class="layui-col-md2">
                                            无（0分）
                                        </div>
                                        <div class="layui-col-md2">
                                            轻(1分)
                                        </div>
                                        <div class="layui-col-md2">
                                            中(2分)
                                        </div>
                                        <div class="layui-col-md2">
                                            重(3分)
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-row">
                                        <div class="layui-col-md2">发热</div>
                                        <div id="option_fare">
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="无" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="37.2~38.3" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="38.3~38.8" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="＞38.8" score="">
                                            </div>
                                        </div>

                                    </div>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-row">
                                        <div class="layui-col-md2">发热持续时间</div>
                                        <div id="option_frcxsj">
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="无" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="37.2~38.3" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="38.3~38.8" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="＞38.8" score="">
                                            </div>
                                        </div>

                                    </div>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-row">
                                        <div class="layui-col-md2">是否用激素(强的松)</div>
                                        <div id="option_sfyjs">
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="无" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="37.2~38.3" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="38.3~38.8" score="">
                                            </div>
                                            <div class="layui-col-md2">
                                                <input type="radio" name="phone" value="I" title="＞38.8" score="">
                                            </div>
                                        </div>

                                    </div>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-row">
                                        <div class="layui-col-md2">&nbsp;</div>
                                        <div class="layui-col-md2">
                                            &nbsp;
                                        </div>
                                        <div class="layui-col-md2">
                                            (<10m强的松或相当剂量的其它激素/d)
                                        </div>
                                        <div class="layui-col-md2">
                                            (10－30m强的松或相当剂量的其它激素/d)
                                        </div>
                                        <div class="layui-col-md2">
                                            (>30m强的松或相当剂量的其它激素/d)
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <div style="font-weight: 600;margin-bottom: 10px;">3、体检检查</div>
                            <div class="layui-row">
                                <div style="font-weight: 600;margin-bottom: 10px;">脂肪储存</div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            眼眶脂肪垫
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="yankuang" value="0" title="正常0" score="0">
                                            <input type="radio" name="yankuang" value="1" title="轻度1" score="1">
                                            <input type="radio" name="yankuang" value="2" title="中度2" score="2">
                                            <input type="radio" name="yankuang" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            三头肌皮褶厚度
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="santouji" value="0" title="正常0" score="0">
                                            <input type="radio" name="santouji" value="1" title="轻度1" score="1">
                                            <input type="radio" name="santouji" value="2" title="中度2" score="2">
                                            <input type="radio" name="santouji" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            下肋脂肪厚度
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="xialei" value="0" title="正常0" score="0">
                                            <input type="radio" name="xialei" value="1" title="轻度1" score="1">
                                            <input type="radio" name="xialei" value="2" title="中度2" score="2">
                                            <input type="radio" name="xialei" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            总体脂肪缺乏程度
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="zhifang" value="0" title="正常0" score="0">
                                            <input type="radio" name="zhifang" value="1" title="轻度1" score="1">
                                            <input type="radio" name="zhifang" value="2" title="中度2" score="2">
                                            <input type="radio" name="zhifang" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-row">
                                <div style="font-weight: 600;margin-bottom: 10px;">肌肉情况</div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            颞部(颞肌)
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="niebu" value="0" title="正常0" score="0">
                                            <input type="radio" name="niebu" value="1" title="轻度1" score="1">
                                            <input type="radio" name="niebu" value="2" title="中度2" score="2">
                                            <input type="radio" name="niebu" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            锁骨部位(胸部三角肌)
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="suogu" value="0" title="正常0" score="0">
                                            <input type="radio" name="suogu" value="1" title="轻度1" score="1">
                                            <input type="radio" name="suogu" value="2" title="中度2" score="2">
                                            <input type="radio" name="suogu" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            肩部(三角肌)
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="jianbu" value="0" title="正常0" score="0">
                                            <input type="radio" name="jianbu" value="1" title="轻度1" score="1">
                                            <input type="radio" name="jianbu" value="2" title="中度2" score="2">
                                            <input type="radio" name="jianbu" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            骨间肌肉
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="gujianjirou" value="0" title="正常0" score="0">
                                            <input type="radio" name="gujianjirou" value="1" title="轻度1" score="1">
                                            <input type="radio" name="gujianjirou" value="2" title="中度2" score="2">
                                            <input type="radio" name="gujianjirou" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            肩胛部(北阔肌、斜方肌、三角肌)
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="jianjia" value="0" title="正常0" score="0">
                                            <input type="radio" name="jianjia" value="1" title="轻度1" score="1">
                                            <input type="radio" name="jianjia" value="2" title="中度2" score="2">
                                            <input type="radio" name="jianjia" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            大腿(四头肌)
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="datui" value="0" title="正常0" score="0">
                                            <input type="radio" name="datui" value="1" title="轻度1" score="1">
                                            <input type="radio" name="datui" value="2" title="中度2" score="2">
                                            <input type="radio" name="datui" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            小腿(腓肠肌)
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="xiaotui" value="0" title="正常0" score="0">
                                            <input type="radio" name="xiaotui" value="1" title="轻度1" score="1">
                                            <input type="radio" name="xiaotui" value="2" title="中度2" score="2">
                                            <input type="radio" name="xiaotui" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            总体肌肉评分
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="jirou" value="0" title="正常0" score="0">
                                            <input type="radio" name="jirou" value="1" title="轻度1" score="1">
                                            <input type="radio" name="jirou" value="2" title="中度2" score="2">
                                            <input type="radio" name="jirou" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-row">
                                <div style="font-weight: 600;margin-bottom: 10px;">液体状况</div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            踝水肿
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="huaishuizhong" value="0" title="正常0" score="0">
                                            <input type="radio" name="huaishuizhong" value="1" title="轻度1" score="1">
                                            <input type="radio" name="huaishuizhong" value="2" title="中度2" score="2">
                                            <input type="radio" name="huaishuizhong" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            骶部水肿
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="dishuizhong" value="0" title="正常0" score="0">
                                            <input type="radio" name="dishuizhong" value="1" title="轻度1" score="1">
                                            <input type="radio" name="dishuizhong" value="2" title="中度2" score="2">
                                            <input type="radio" name="dishuizhong" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            腹水
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="fushui" value="0" title="正常0" score="0">
                                            <input type="radio" name="fushui" value="1" title="轻度1" score="1">
                                            <input type="radio" name="fushui" value="2" title="中度2" score="2">
                                            <input type="radio" name="fushui" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                    <div class="layui-col-md6">
                                        <div class="layui-col-md4">
                                            总体水评分
                                        </div>
                                        <div class="layui-col-md6">
                                            <input type="radio" name="tishui" value="0" title="正常0" score="0">
                                            <input type="radio" name="tishui" value="1" title="轻度1" score="1">
                                            <input type="radio" name="tishui" value="2" title="中度2" score="2">
                                            <input type="radio" name="tishui" value="3" title="严重3" score="3">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <div style="font-weight: 600;margin-bottom: 10px;">PG-SGA总体评价</div>
                            <div class="layui-row">
                                <div class="layui-inline">1、定性评价</div>
                                <div class="layui-inline">
                                    <input type="radio" name="dingxing" value="1" title="营养良好(A)" score="1">
                                    <input type="radio" name="dingxing" value="2" title="轻度/中度营养不良(B)" score="2">
                                    <input type="radio" name="dingxing" value="3" title="重度营养不良(C)" score="3">
                                </div>
                            </div>
                            <div class="layui-row" style="margin-top: 5px;">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="padding-left: 0;padding-right: 20px;">2、定量评价</label>
                                    <button class="layui-btn layui-input-inline" style="width: 92px;" id="total_score_btn" lay-submit="" lay-filter="total_score">四项总分</button>
                                    <div class="layui-input-inline">
                                        <input type="text" name="pingfen" placeholder="" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">分</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </fieldset>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="last">上一步</button>
                            <button class="layui-btn" lay-submit="" lay-filter="next">下一步</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>


<script src="__STATIC__/layuikn/layui/layui.js"></script>
<script>
    layui.config({
        base: '__STATIC__/layuikn/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
        ,ajaxData:'../extends/ajaxData'
        ,getOption:'../extends/getOption'
    }).use(['index', 'jquery', 'ajaxData', 'getOption', 'form', 'laydate'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,ajaxData = layui.ajaxData
            ,getOption = layui.getOption
            ,form = layui.form;

        var pid = sessionStorage.getItem('pid');
        ajaxData.ajaxData('GET',"{:url('patient/info')}?pid=" + pid,{},function (back) {
            if(back.data){
                $('#huanzhe_hospital_id').html(back.data.hospital_id);
                $('#huanzhe_name').html(back.data.name);
                $('#huanzhe_gender').html(back.data.gender);
                $('#huanzhe_keshi').html(back.data.keshi);
                $('#huanzhe_age').html(back.data.age);
                $('#huanzhe_created').html(back.data.created);
                $('input[name="age"]').val(back.data.age);
            }
        });

        var option_all;


        $.ajax({
            url: "{:url('option/all',[])}",
            type: 'get',
            contentType: 'application/json',
            dataType: 'json',
            async: false, // 同步
            success: function (result) {
                option_all = result;
            }
        });

        var option_jibing =  getOption.option(option_all, '疾病');
        //console.log(option_jibing);
        var option_fare =  getOption.option(option_all, '发热');
        //console.log(option_fare);
        var option_frcxsj =  getOption.option(option_all, '发热持续时间');
        //console.log(option_frcxsj);
        var option_sfyjs =  getOption.option(option_all, '是否用激素');
        console.log(option_sfyjs);

        //疾病
        var option_jibing_html = '';
        $.each(option_jibing.children,function (k,v) {
            option_jibing_html += '<div class="layui-col-md4">\n' +
                '                <input type="checkbox" name="jibing_option" lay-filter="jibing" value="' + v.id + '" title="' + v.name + '" score="' + v.v + '">\n' +
                '                </div>';
        });
        $('#option_jibing').html(option_jibing_html);

        //发热
        var option_fare_html = '';
        $.each(option_fare.children,function (k,v) {
            option_fare_html += ' <div class="layui-col-md2">\n' +
                '                         <input type="radio" name="fare" value="' + v.id + '" title="' + v.name + '" score="' + v.v + '">\n' +
                '                    </div>';
        });
        $('#option_fare').html(option_fare_html);

        //发热持续时间
        var option_frcxsj_html = '';
        $.each(option_frcxsj.children,function (k,v) {
            option_frcxsj_html += ' <div class="layui-col-md2">\n' +
                '                         <input type="radio" name="fare_cxsj" value="' + v.id + '" title="' + v.name + '" score="' + v.v + '">\n' +
                '                    </div>';
        });
        $('#option_frcxsj').html(option_frcxsj_html);

        //是否用激素
        var option_sfyjs_html = '';
        $.each(option_sfyjs.children,function (k,v) {
            option_sfyjs_html += ' <div class="layui-col-md2">\n' +
                '                         <input type="radio" name="is_jisu" value="' + v.id + '" title="' + v.name + '" score="' + v.v + '">\n' +
                '                    </div>';
        });
        $('#option_sfyjs').html(option_sfyjs_html);
        form.render();

        form.on('radio(tangpijishu)', function (data) {
            if(data.value == 1){
                $('input[name="yaowu"]').removeAttr('disabled');
                $('input[name="jiliang"]').removeAttr('disabled');
            }else{
                $('input[name="yaowu"]').attr('disabled','disabled');
                $('input[name="yaowu"]').val('');
                $('input[name="jiliang"]').attr('disabled','disabled');
                $('input[name="jiliang"]').val('');
            }
        });

        //监听复选框
        form.on('checkbox(jibing)', function (data) {
            var number = $('input[name="jibing"]'), value = data.value, array = number.val().split(",");
            var score = $(this).attr('score');
            var zongfen = $('#zongfen');
            var panding = $('#panding'), text = $(this).attr('title'), panding_array = panding.val().split(",");
            var zongfen_total = 0;
            if(zongfen.val() != ''){
                zongfen_total = parseInt(zongfen.val());
            }
            if (data.elem.checked) {
                number.val(number.val() + value + ",");
                panding.val(panding.val() + text + ",");
                zongfen.val(zongfen_total + parseInt(score));
            } else {
                //疾病选中
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
                //总分计算
                zongfen.val(parseInt(zongfen.val()) - parseInt(score));
                //相关疾病(断定)
                var panding_text = "";
                for (var j = 0; j < panding_array.length; j++) {
                    var panding_str = panding_array[j];
                    panding_text += (panding_str != text && panding_str != "" && panding_str != null) ? panding_str + "," : "";
                }
                panding.val(panding_text);
            }
        });

        function initjibingValue() {
            var param=$("input[name='jibing']").val(),checkBoxs = $("input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        break;
                    }
                }
            }
            form.render('checkbox');
        }


        ajaxData.ajaxData('GET',"{:url('pgsgayisheng/info')}?pid=" + pid,{},function (back) {

            if(back.data){
                //给表单赋值
                form.val("pgsgayisheng-form", back.data);
                if($('input[name="yaowu"]').val() != ''){
                    $('input[name="yaowu"]').removeAttr('disabled');
                }
                if($('input[name="jiliang"]').val() != ''){
                    $('input[name="jiliang"]').removeAttr('disabled');
                }
            }
            initjibingValue();
            //form.render();
        });
        form.on('submit(total_score)',function () {
            var zongfen = parseInt($('#zongfen').val());
            var fare = 0;
            var fare_time = 0;
            var is_jisu = 0;
            var jirou = 0;

            if($("input[name=fare]:checked").attr('score') !== undefined){
                fare = parseInt($("input[name=fare]:checked").attr('score'));
            }
            if($("input[name=fare_time]:checked").attr('score') !== undefined){
                fare_time = parseInt($("input[name=fare_time]:checked").attr('score'));
            }
            if($("input[name=is_jisu]:checked").attr('score') !== undefined){
                is_jisu = parseInt($("input[name=is_jisu]:checked").attr('score'));
            }
            if($("input[name=jirou]:checked").attr('score') !== undefined){
                jirou = parseInt($("input[name=jirou]:checked").attr('score'));
            }

            $('input[name="pingfen"]').val(zongfen + fare + fare_time + is_jisu + jirou);
            return false;
        })
        form.on('submit(last)',function(data){
            if(pid == 'null') return  false;
            window.location.href = "{:url('pgsgahuanzhe/show')}";
            return  false;
        });
        /* 监听提交 */
        form.on('submit(next)', function(data){
            if(pid == 'null') return  false;
            ajaxData.ajaxData('POST', "{:url('pgsgayisheng/update')}?pid=" + pid, data.field,function (back) {
                console.log(data.field);
                if(back.code == 200){
                    window.location.href = "{:url('nrs2002/show')}";
                }else{
                    layer.msg(back.msg, {icon: 5});
                }
            });
            // parent.layer.alert(JSON.stringify(data.field), {
            //     title: '最终的提交信息'
            // })
            return false;
        });

    });
</script>
</body>
</html>
